using System.Text.Json.Serialization;

namespace KeyAuthService.Models
{
    /// <summary>
    /// 密钥信息模型类
    /// </summary>
    public class KeyInfo
    {
        /// <summary>
        /// 密钥名称（唯一标识）
        /// </summary>
        [JsonPropertyName("keyName")]
        public string KeyName { get; set; } = string.Empty;

        /// <summary>
        /// 算法类型（如SM2、ECDSA_P256等）
        /// </summary>
        [JsonPropertyName("algo")]
        public string Algorithm { get; set; } = string.Empty;

        /// <summary>
        /// 公钥
        /// </summary>
        [JsonPropertyName("publicKey")]
        public string PublicKey { get; set; } = string.Empty;

        /// <summary>
        /// 私钥（加密存储）
        /// </summary>
        [JsonPropertyName("privateKey")]
        public string PrivateKey { get; set; } = string.Empty;

        /// <summary>
        /// 地址（如区块链地址）
        /// </summary>
        [JsonPropertyName("address")]
        public string? Address { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [JsonPropertyName("createdAt")]
        public DateTime CreatedAt { get; set; } = DateTime.Now;

        /// <summary>
        /// 上次使用时间
        /// </summary>
        [JsonPropertyName("lastUsed")]
        public DateTime? LastUsed { get; set; }

        /// <summary>
        /// 元数据（扩展信息）
        /// </summary>
        [JsonPropertyName("metadata")]
        public Dictionary<string, object>? Metadata { get; set; }

        /// <summary>
        /// 是否已撤销
        /// </summary>
        [JsonPropertyName("revoked")]
        public bool Revoked { get; set; } = false;

        /// <summary>
        /// 撤销时间
        /// </summary>
        [JsonPropertyName("revokedAt")]
        public DateTime? RevokedAt { get; set; }
    }
} 